public class Test1 {

    public static void main(String arg[]) {
        double[] myList = {1.2, 1.9, 2.2, 3};

        // 打印数组
        for (int i = 0; i < myList.length; i++) {
            System.out.println(myList[i] + " ");
        }

        // 计算所有元素的总和
        double total = 0;
        for (int i = 0; i < myList.length; i++) {
            total += myList[i];
        }
        System.out.println("Total is " + total);

    }
}
